package com.uphone.magicleafteacher.pro.adapter;

import com.blankj.utilcode.util.SizeUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.uphone.magicleafteacher.R;
import com.uphone.magicleafteacher.util.CommonUtil;
import com.uphone.magicleafteacher.view.MyBaseViewHolder;
import com.uphone.magicleafteacher.vo.OtherLiveClassBean;

public class CoursesAdapter extends BaseQuickAdapter<OtherLiveClassBean.LiveClassListBean, MyBaseViewHolder> {


    public CoursesAdapter() {
        super(R.layout.item_courses);
    }

    @Override
    protected void convert(MyBaseViewHolder helper, OtherLiveClassBean.LiveClassListBean item) {
//        直播状态, 0: 未开始, 1: 直播中, 2: 直播结束 3:已经打过积分
        helper.setImageViewCorner(mContext, R.id.img_bg, CommonUtil.getImageUrl(item.getFacePic()), SizeUtils.dp2px(5))
                .setText(R.id.text_course, CommonUtil.getStr(item.getClassName()))
                .setText(R.id.tv_time_start, CommonUtil.getStr(item.getStartTime()))
                .setText(R.id.other_courses_type, item.getLiveStatus() == 0 ? "未开始" : item.getLiveStatus() == 1 ? "直播中" : "已结束")
                .setBackgroundRes(R.id.other_courses_type, item.getLiveStatus() == 0 ? R.drawable.item_other_curriculum_notstarted : item.getLiveStatus() == 1 ? R.drawable.item_other_curriculum_begin : R.drawable.item_other_curriculum_end)
//                .setGone(R.id.by_buy_course, item.getLiveStatus() == 0)
                .setText(R.id.tv_time_end, CommonUtil.getStr(item.getEndTime()))
                .setText(R.id.test_money, CommonUtil.getStr(item.getMoney() + ""))
                .setText(R.id.text_integral, CommonUtil.getStr(item.getJifen() + ""))
                .addOnClickListener(R.id.by_buy_course);

    }


}
